home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 6
/
FM Towns Free Software Collection 6.iso
/
t_os
/
na386
/
chksum.bas
< prev
next >
Wrap
BASIC Source File
|
1993-07-08
|
1KB
|
27 lines
1000 PRINT "<<< Check SUM 付加プログラム ver1.0 >>>"
1010 PRINT " 1991/10 By N.Takahashi"
1020 DEFLNG A-Z:S=0
1030 LINE INPUT "File name = ",FI$
1040 IF FI$=" " OR FI$="" THEN 1250
1050 OPEN "I",#1,FI$:CLOSE #1
1060 A=INSTR(FI$,":")
1070 IF A>0 THEN FI$=LEFT$(FI$,A)+"(1)"+MID$(FI$,A+1) ELSE FI$="(1)"+FI$
1080 OPEN "R",#1,FI$
1090 FIELD #1,1 AS EP$
1100 GET #1,1:A=ASC(EP$):GET #1,2:A=ASC(EP$)*256+A
1110 IF (A=&H514D OR A=&H504D)=0 THEN 1250
1120 I=1:FLM=LOF(1)
1130 IF (I-1) MOD 256=0 THEN PRINT "*";
1140 IF I=&H13 OR I=&H14 THEN I=I+1:GOTO 1140
1150 GET #1,I:I=I+1:A=ASC(EP$)
1160 IF I<=FLM THEN GET #1,I:I=I+1:A=ASC(EP$)*256+A
1170 S=(S+65536-A) MOD 65536
1180 IF I<=FLM THEN 1130
1190 S=(S+65535) MOD 65536
1200 'GET #1,&H13:A=ASC(EP$):GET #1,&H14:A=ASC(EP$)*256+A
1210 'PRINT :PRINT "Original SUM is "+RIGHT$("000"+HEX$(A),4)+"h"
1220 PRINT :PRINT "Negative SUM is "+RIGHT$("000"+HEX$(S),4)+"h"
1230 LSET EP$=CHR$(S MOD 256):PUT #1,&H13
1240 LSET EP$=CHR$(S \ 256):PUT #1,&H14
1250 PRINT :CLOSE #1:END